// 统一配置
let baseUrl = 'http://www.itcbc.com:8080'
$.ajaxPrefilter(function (option) {
    // 1.统一配置url
    option.url = baseUrl + option.url
    // 2.同意携带请求头
    option.headers = {
        Authorization: localStorage.getItem('token')
    }
    // 3.ajax完成后,判断token的真假
    option.complete = function (xhr) {
        let res = xhr.responseJSON
        if (res && res.status === 1 && res.message === '身份认证失败') {
            localStorage.removeItem('token')
            location.href = './login.html'
        }
    }
})